<!DOCTYPE html>
<html lang="zh">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet"> </head>

<body>
    <div id="myApp">
        <ol>
            <game-item v-for="item in games" v-bind:game="item"></game-item>
        </ol>
    </div>
    <script>
        /* 组件定义：game-item */
        Vue.component('game-item', {
            props: ['game'],
            template: '<li>{{ game.title }}</li>'
        });
        /* Vue对象实例化 */
        var myApp = new Vue({
            el: '#myApp',
            data: {
                games: [{
                    title: '斗地主'
                }, {
                    title: '打麻雀'
                }, {
                    title: 'UNO'
                }]
            }
        });
    </script>
</body>

</html>